<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script
        src="https://dss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/jquery/jquery-1.10.2.min_65682a2.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>

<body>
    <div id="app">

        <div style="display: flex;">
            员工编号: {{item.EMPLOYEE_ID }}  
            姓名:  <input type="text" v-model="item.FIRST_NAME">
            工资 :<input type="text" v-model="item.SALARY "/>  
            <div @click=modify(2,item)>删除</div><div @click="modify(1,item)">修改</div>
        </div>

    </div>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                id:"",
                helloData: {},
                list:[],
                item:"",
            },
            created() {
                var a=window.location.search.split("?")[1].split("=")[1];
                this.id=a;
                var _this=this;
                $.get("http://localhost:8080/emplist", { id:a},
                    function(data){
                        
                        data=JSON.parse(data)
                        
                        _this.list=data
                        _this.item=data[0]
                        console.log(_this.list)
                    });
            },
            methods: {
                ///1更新,2删除,3新僧
                modify(type,item){
                    $.get("http://localhost:8080/modifyEmp", {...item,type:type},
                    function(data){ 
                        console.log(data+"data")
                        if(data>0){
                            alert("操作成功")
                        }else{
                            alert("操作失败")
                        }
                        window.history.go(-1);
                    });
                }
            },

            　mounted:function(){
        　　　　　　console.log(this.list);
        　　　　}
        })
    </script>
</body>

</html>